//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CJFFS2DIRSTRENUMERATOR_H__)
#define __CJFFS2DIRSTRENUMERATOR_H__

#include "_CJffs2DirStrEnumerator.h"
#include "Jffs2Directory.h"
#include "nodelist.h"

class CJffs2DirStrEnumerator : public _CJffs2DirStrEnumerator
{
public:
    CARAPI Current(
        /* [out] */ WStringBuf * pPsa);

    CARAPI MoveNext();

    CARAPI Reset();

    CJffs2DirStrEnumerator(
        CJffs2Directory  * const pBasicDirectory);

    ~CJffs2DirStrEnumerator();
    CJffs2DirStrEnumerator()
    {
    }
    ;

private:
    // TODO: Add your private member variables here
    CJffs2Directory *m_pBasicDirectory;

    char m_current[NAME_MAX_LEN + 1];
};

inline CJffs2DirStrEnumerator::CJffs2DirStrEnumerator(
                CJffs2Directory *const pBasicDirectory)
{
    m_pBasicDirectory = pBasicDirectory;
    m_pBasicDirectory->AddRef();
    IoOperator::jffs2_fo_dirlseek(&m_pBasicDirectory->m_file, NULL, SEEK_SET);
    m_current[0] = '\0';
}

inline CJffs2DirStrEnumerator::~CJffs2DirStrEnumerator()
{
    if (m_pBasicDirectory) {
        m_pBasicDirectory->Release();
    }
}

#endif //!(__CJFFS2DIRSTRENUMERATOR_H__)
